<?php


namespace app\controller;

use app\model\AlbumPhoto;
use app\process\CalFeature;

/**
 * 相册
 * @package app\controller
 */
class AlbumTag extends BackendController{
    protected $model = null;
    protected $noNeedRight=['*'];
    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\model\AlbumTag();
    }

    public function after_index($lists) {
        $results=[];
        foreach ($lists as $list) {
            $results[$list['group']][]=$list;
        }
        $lists=[];
        foreach ($results as $key=>$result) {
            $list=[];
            $list['label']=$key;
            foreach ($result as $item) {
                $single['value']=$item['id'];
                $single['label']=$item['name'];
                $list['options'][]=$single;
            }
            $lists[]=$list;
        }
        return $lists;
    }
}